﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI/themes/gray/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/CommonUnite.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <!-- 增加一个配置  -->
    <script src="../../../Scripts/config.js" type="text/javascript"> </script>
    <script type="text/javascript">

        $(function () {

            ShowFields();

            var Ele_TBName = document.getElementById("TB_Name");
            Ele_TBName.focus();

            PageTransfer_value = Application.common.getArgsFromHref("DataType"); //取出页面传至
            //给单选赋值
            if (PageTransfer_value == "TextBox") {
                $("#RB_String").attr("checked", true);
            }

            if (PageTransfer_value == "TextBoxInt") {
                $("#RB_Int").attr("checked", true);
            }

            if (PageTransfer_value == "TextBoxFloat") {
                $("#RB_Float").attr("checked", true);
            }

            if (PageTransfer_value == "TextBoxMoney") {
                $("#RB_Money").attr("checked", true);
            }

            if (PageTransfer_value == "Date") {
                $("#RB_Date").attr("checked", true);
            }

            if (PageTransfer_value == "DateTime") {
                $("#RB_DateTime").attr("checked", true);
            }

            if (PageTransfer_value == "CheckBox") {
                $("#RB_Boolen").attr("checked", true);
            }

        });

        //显示所有的字段.
        function ShowFields() {
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_CCFormDesigner_DialogCtr");
            handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
            handler.AddPara("DataType", GetQueryString("DataType"));
            var data = handler.DoMethodReturnString("FrmTextBoxChseOneField_Init");

            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red><br>" + data + "</font> .");
                return;
            }

            if (data.indexOf('url@') == 0) {
                var url = data.replace('url@', '');
                SetHref(url);
                return;
            }

            var dataType = GetQueryString("DataType");

            //转json.
            var dt = JSON.parse(data);

            if (dt.length == 0) {
                alert('系统中已无可用的该类型的字段.');
                window.close();
                return;
            }

            var html = "<table border=0>";

            var num = 0;
            for (var i = 0; i < dt.length; i++) {

                var item = dt[i];

                var fType = item.FType;

                //日期，日期时间，字符串，都用 char.
                if ((dataType == "TextBox" || dataType == "Date" || dataType == "DateTime")
                        && item.FType.indexOf('char') == -1) {
                    continue;
                }

                // int , boolen 都用int类型.
                if ((dataType == "TextBoxInt" || dataType == "CheckBox") && item.FType.indexOf('int') == -1) {
                    continue;
                }

                if (dataType == "TextBoxFloat" && item.FType.indexOf('float') == -1) {
                    continue;
                }

                if (dataType == "TextBoxDecimal" && item.FType.indexOf('decimal') == -1) {
                    continue;
                }

                if (dataType == "TextBoxMoney" && item.FType.indexOf('decimal') == -1) {
                    continue;
                }

                num++;

                if (i % 3 == 0) {
                    html += "<tr>";
                }

                html += "<td nowrap style='width: 33%'>";

                html += "<input id='" + item.FName + "' onclick=\"javascript:SelectIt('" + item.FName + "','" + item.FDesc + "')\" name='xx' type='radio' name='" + item.FName + "'  />";
                html += "<label for='" + item.FName + "'>" + item.FDesc + "(" + item.FName + "){" + item.FType + "}</label>";

                html += "</td>";

                if (i % 3 == 2) {
                    html += "</tr>";
                }

            }
            html += "</table>" + GetQueryString("DataType");

            if (num == 0) {
                $("#docs").append("系统中已无可用的该类型的字段.");
            } else {
                $("#docs").append(html);
            }

            $("#Msg").html("");

        }

        function SelectIt(no, name) {
            document.getElementById("TB_KeyOfEn").value = no;
            document.getElementById("TB_Name").value = name;
        }
        //传入父窗体
        function GetFrmInfo() {
            return {
                Name: $.trim($("#TB_Name").val()),
                KeyOfEn: $.trim($("#TB_KeyOfEn").val()),
                IsCreateLabel: $("#CB_scbq").prop("checked"),
                IsHidenField: $("#CB_sfyczd").prop("checked"),
                FieldType: $('input:radio[name=Field_Type]:checked').val()
            };
        }
    </script>
</head>
<body>
    <form id="from1" action="">
    <div id="docs">
    </div>
    <br />
    <div id="Msg">
        正在加载请稍候...</div>
    <table class="Table" cellpadding="0" cellspacing="0" border="0" style="width: 100%;">
        <tr>
            <td>
                字段中文名称
            </td>
            <td>
                字段类型
            </td>
        </tr>
        <tr>
            <td>
                <input id="TB_Name" class="easyui-textbox" style="width: 200px" />
            </td>
            <td rowspan="4" style="">
                <input id="RB_String" type="radio" name="Field_Type" value="1" checked="checked"
                    disabled /><label for="RB_String">文字类型(地址、电话、公司名称)</label><br />
                <input id="RB_Int" type="radio" name="Field_Type" value="2" disabled /><label for="RB_Int">整数类型(年龄、个数)</label><br />
                <input id="RB_Float" type="radio" name="Field_Type" value="3" disabled /><label for="RB_Float">浮点类型(身高、体重、长度)</label><br />
                <input id="RB_Money" type="radio" name="Field_Type" value="8" disabled /><label for="RB_Money">金额类型(应付、应收、单价)</label><br />
                <input id="RB_Date" type="radio" name="Field_Type" value="6" disabled /><label for="RB_Date">日期类型(出生日期、还款日期)</label><br />
                <input id="RB_DateTime" type="radio" name="Field_Type" value="7" disabled /><label
                    for="RB_DateTime">日期时间类型(发生时间、出发时间)</label><br />
                <input id="RB_Boolen" type="radio" name="Field_Type" value="4" disabled /><label
                    for="RB_Boolen">Boolen型(是否同意、是否结算)</label><br />
            </td>
        </tr>
        <tr>
            <td>
                英文字段<font color="gray">(必须以下划线字母开头) </font>
            </td>
        </tr>
        <tr>
            <td>
                <input id="TB_KeyOfEn" class="easyui-textbox" style="width: 200px" readonly="readonly" />
            </td>
        </tr>
        <tr>
            <td>
                <input id="RB_qp" type="radio" name="RB_qpjp" checked="checked" value="ziduanquanpin" /><label
                    for="RB_qp">字段全拼</label>
                <input id="RB_jp" type="radio" name="RB_qpjp" value="ziduanjianpin" /><label for="RB_jp">字段简拼</label>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input id="CB_scbq" type="checkbox" checked="checked" /><label for="CB_scbq">是否根据名称生成标签</label>
                <input id="CB_sfyczd" type="checkbox" /><label for="CB_sfyczd">是否隐藏字段</label>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
